import request from '@/utils/request'

export function addBook(book) {
  return request({
    url: '/vue-element-admin/book/add',
    method: 'post',
    data: book
  })
}

export function getBooks({ pageSize, pageNo }) {
  return request({
    url: '/vue-element-admin/book/list',
    method: 'get',
    params: {
      pagesize: pageSize,
      pageno: pageNo
    }
  })
}

export function getTotal() {
  return request({
    url: '/vue-element-admin/book/total',
    method: 'get'
  })
}

export function delBook(id) {
  return request({
    url: '/vue-element-admin/book/del',
    method: 'get',
    params: {
      bookId: id
    }
  })
}

export function findBookById(id) {
  return request({
    url: '/vue-element-admin/book/findBookById',
    method: 'get',
    params: {
      bookId: id
    }
  })
}

export function updateBook(book) {
  return request({
    url: '/vue-element-admin/book/update',
    method: 'post',
    data: book
  })
}
